import cloud from '@tbmp/mp-cloud-sdk';
cloud.init({
  env: 'online' 
});
App({
	cloud,
  EffectiveTime:'',
  H:"",
  edit:"",
  typee:"",


  // activityId:387,    //记得注释

  onLaunch(options) {
    
    // 登陆授权
    //this.httpRqs()
  },

  httpRqs(){

    my.authorize({
      scopes: 'scope.userInfo',
      success: (res) => {
        my.getAuthUserInfo({
          success: (userInfo) => {
            
            cloud.application.httpRequest({
              'path' : '/api/b/user/login', 
              'method':'POST',
              'headers':{ "Content-Type":"application/json"},
              'body':{avatar:userInfo.avatar,user_nick:userInfo.nickName},
              }).then(ress => {

                this.getTime();

            })

          }
        });
      },
    });

  },

  getTime(){
    cloud.application.httpRequest({
      'path' : '/api/b/user/getOrderTime', 
      'method':'GET',
      'headers':{ "Content-Type":"application/json"},
      'body':{},
    }).then(ress => {

      my.alert({conten:ress})
      this.EffectiveTime = JSON.parse(ress.data).user_subscribe.end_date
    })
  },

  
  onShow(options) {
    // 从后台被 scheme 重新打开
    // options.query == {number:1}
  },
});
